package Others.DesignPattern.AbstractFactoryPattern.Pattern;

import Others.DesignPattern.AbstractFactoryPattern.Pattern.Object.*;

public class main {
    public static void main(String[] args) {
            //抽象的基本使用
        Department department = new Department("1");
        User user = new User("1");

        //二者用其一即可实现不同的结果
//        IFactory oracleFactory = new OracleFactory();
        IFactory factory = new MySQLFactory();
        IDepartment departmentMySQLFactory = factory.createDepartment();
        departmentMySQLFactory.Insert(department);
        departmentMySQLFactory.GetUser("1");
        System.out.println();
        IUser userMySQLFactory = factory.createUser();
        userMySQLFactory.Insert(user);
        userMySQLFactory.GetUser("1");
        System.out.println();


        //有什么好处呢，就是我们如果需要一个新的sql--那么只需要更换一个工厂类即可实现，不同的功能
        //但是缺点也暴露出来了，就是类太过繁杂
        //那有没有简单的更改方法呢---有的--进步一步优化--采用简单工厂模式-->进一步引出：反射+配置文件

    }
}
